#ifndef PROTEINVIEW2D_H
#define PROTEINVIEW2D_H

#include <fltk/ScrollGroup.h>
#include <fltk/Button.h>

#include <profo/profo.h>
#include <profo/Protein.h>
#include <profo/HP2DRectangularView.h>

namespace profo {

class HP2DRectangularView;

/**
 * A fltk::ScrollGroup subclass which serves as a VIEW for the Protein (model).
 */
class ProteinView2D : public fltk::ScrollGroup
{
  public:
  //VARIABLES
  HP2DRectangularView* mainViewPtr; ///< A pointer to the main view object
  fltk::Widget minusX; ///< An -X label on the X axis
  fltk::Widget plusX; ///< An +X label on the X axis
  fltk::Widget minusY; ///< An -Y label on the Y axis
  fltk::Widget plusY; ///< An +Y label on the Y axis

  // METHODS
  ProteinView2D(Protein& argProtein, int x, int y, int w, int h, const char* l = 0);
  void draw();
  void clearView();
  int transX(int arg);
  int transY(int arg);

  // ACCESSORS
  void protein(Protein& arg) { _proteinRef = arg; }
  Protein& protein() const { return _proteinRef; }
  void update();
  fltk::Button* selected() const { return _selectedPtr; } ///< Returns a pointer to the selected button.
  void selected(fltk::Button* arg) { _selectedPtr = arg; }
  fltk::Color oldColor() const { return _oldColor; }
  void oldColor(fltk::Color arg) { _oldColor = arg; }
  fltk::Color hColor() const { return _hcolor; }
  void hColor(fltk::Color arg) { _hcolor = arg; }
  fltk::Color pColor() const { return _pcolor; }
  void pColor(fltk::Color arg) { _pcolor = arg; }
  fltk::Color sColor() const { return _scolor; }
  void sColor(fltk::Color arg) { _scolor = arg; }

  // CALLBACKS
  static void acidClickCb(fltk::Button* w, void* data = 0);

  protected:
  void drawBackground();
  void drawConnections();
  void initAxisLabels();

  private:
  fltk::Button* _selectedPtr; ///< Determines which amino acid is the selected one
  Protein& _proteinRef; ///< We hold a reference to the Protein object here.
  unsigned char _step; ///< Used for translating from protein coordinates to view coordinates.
  unsigned char _asize; ///< Size of amino acids in the view (size of buttons).
  std::vector<fltk::Button*> _buttons; ///< A vector of buttons that represent amino acids.
  std::vector<std::string> _tooltips; ///< A vector that contains tooltips for buttons.
  fltk::Color _oldColor; ///< Here we store the color of the previously selected button.
  fltk::Color _hcolor; ///< Color for hydrophobic amino acid.
  fltk::Color _pcolor; ///< Color for polar amino acid.
  fltk::Color _scolor; ///< Color for the selected amino acid.
/* TODO: remove this
  int _newX;
  int _newY;
  int _newW;
  int _newH;
*/
}; // ProteinView2D class

} // profo namespace

// $Id: ProteinView2D.h 42 2009-04-26 04:31:13Z dejan.lekic $

#endif // PROTEINVIEW_H
